import NestedRoute from './NestedRoute'
import StatusRoute from './StatusRoute'
import loadable from '@loadable/component'
import Index from '../views/index/Index'

const router = [
    {
        path: '/index',
        component: Index
    },
    {
        path: '/channel/:rId',
        component: loadable(() =>
            import(/* webpackChunkName: 'channel' */ '../views/channel/Channel')
        )
        // asyncData: (store) => {
        //   // return store.dispatch(getIndexContent());
        // }
    },
    {
        path: '/ranking/:rId',
        component: loadable(() =>
            import(/* webpackChunkName: 'ranking' */ '../views/ranking/Ranking')
        )
        // asyncData: (store) => {
        //   // return store.dispatch(getIndexContent());
        // }
    },
    {
        path: '/video/av:aId',
        component: loadable(() => import(/* webpackChunkName: 'video' */ '../views/video/Video'))
        // asyncData: (store) => {
        //   // return store.dispatch(getIndexContent());
        // }
    },
    {
        path: '/space',
        component: loadable(() => import(/* webpackChunkName: 'space' */ '../views/space/Space')),
        routes: [
            {
                path: '/space',
                component: loadable(() =>
                    import(/* webpackChunkName: 'history' */ '../views/space/History')
                ),
                exact: true
            },
            {
                path: '/space/:mId',
                component: loadable(() =>
                    import(/* webpackChunkName: 'upuser' */ '../views/space/UpUser')
                )
                // asyncData: (store, param) => {
                //   return store.dispatch(getUpUserInfo(param.mId));
                // }
            }
        ]
    },
    {
        path: '/search',
        component: loadable(() => import(/* webpackChunkName: 'search' */ '../views/search/Search'))
    },
    {
        path: '/live',
        component: loadable(() =>
            import(/* webpackChunkName: 'live-index' */ '../views/live/Live')
        ),
        exact: true
    },
    {
        path: '/live/list',
        component: loadable(() => import(/* webpackChunkName: 'live-list' */ '../views/live/List'))
    },
    {
        path: '/live/areas',
        component: loadable(() => import(/* webpackChunkName: 'live-area' */ '../views/live/Area'))
    },
    {
        path: '/live/:roomId',
        component: loadable(() => import(/* webpackChunkName: 'live-room' */ '../views/live/Room'))
    }
]

export default router

export { NestedRoute, StatusRoute }
